const jumpConf = [
    { label: '不跳转', value: 'n' },
    { label: 'h5', value: 'h5'} ,
    { label: '聚推客活动', value: 'jtk'} ,
    { label: '视频号', value: 'tx_video' },
    { label: '任务详情', value: 'activity' },
    { label: '小程序', value: 'mini' },
    { label: '弹窗图片', value: 'modal_img' },
    { label: '图文页', value: 'tw' },
    { label: '跳转密令页', value: 'ml' },
];

export default {
    jumpConf: jumpConf,
    jumpTbColumn:[
        {
            title: '跳转方式', dataIndex: 'jump_type', search: false, commonRules: [{required: true, message: '请选择跳转方式'}],
            dict: {data: jumpConf, translation: true}, formType: 'select',
            onControl: (value, maFormObject) => {
                const service = maFormObject.getColumnService()
                const dataIndexList = ['mini_appid', 'mini_path', 'modal_path', 'h5_url', 'v_id', 'v_name','v_token','content','activity_id','jtk_id','banner','ml','img_jc', 'priority']

                if (value === 'undefined') {
                    dataIndexList.map(name => service.get(name).setAttr('display', false))
                    return
                }
                if (['modal_img'].includes(value)) {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['modal_path'].includes(name)))
                    return
                }
                if (value === 'mini') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['mini_appid', 'mini_path'].includes(name)))
                    return
                }
                if (value === 'tw') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['content'].includes(name)))
                    return
                }
                if (value === 'tx_video') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['v_id', 'v_name','v_token'].includes(name)))
                    return
                }
                if (value === 'h5') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['h5_url'].includes(name)))
                    return
                }
                if (value === 'jtk') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['jtk_id', 'banner', 'img_jc', 'priority'].includes(name)))
                    return
                }
                if (value === 'activity') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['activity_id'].includes(name)))
                    return
                }
                if (value === 'ml') {
                    dataIndexList.map(name => service.get(name).setAttr('display', ['banner', 'ml','img_jc'].includes(name)))
                    return
                }
                dataIndexList.map(name => service.get(name).setAttr('display', false))
            },
        },
        {
            title: 'APPID', dataIndex: 'mini_appid', hide: true,
        },
        {
            title: '路径', dataIndex: 'mini_path', hide: true,
        },
        {
            title: '图片', dataIndex: 'modal_path', hide: true, formType: 'upload',
        },
        {
            title: 'url地址', dataIndex: 'h5_url', hide: true
        },
        {
            title: '视频ID', dataIndex: 'v_id', hide: true,
        },
        {
            title: '聚推客活动ID', dataIndex: 'jtk_id', hide: true,
        },
        {
            title: '优先', dataIndex: 'priority', hide: true,addDefaultValue: 'url', formType: 'select', dict: {data: [{label: '链接', value: 'url'},{label: '口令', value: 'kl'}], translation: true},
        },

        {title: '视频name', dataIndex: 'v_name', hide: true, },
        {title: '任务ID', dataIndex: 'activity_id', hide: true, },

        {
            title: '活动ID', dataIndex: 'v_token', hide: true,
        },
        {
            title: '详情', dataIndex: 'content', hide: true, formType: 'editor',
        },
        {
            title: '密令banner', dataIndex: 'banner', hide: true, formType: 'upload',
        },
        {
            title: '密令', dataIndex: 'ml', hide: true, formType: 'input',
        },
        {
            title: '密令教程', dataIndex: 'img_jc', hide: true, formType: 'upload',
        },
    ]
}
